<template>
  <div>
    <el-row>
            <p><b>首页</b>/订单监控/操作日志</p>
    </el-row>

    <el-row>
        <el-table
            :data="dataList"
            style="width: 100%"
            >
            <el-table-column
            fixed
            prop="id"
            label="id号"
            >
            </el-table-column>
            <el-table-column
            prop="operation"
            label="操作"
            >
            </el-table-column>
            <el-table-column
            prop="type"
            label="类型"
            >
            </el-table-column>
            <el-table-column
            prop="ip"
            label="ip地址"
            >
            </el-table-column>
            <el-table-column
            prop="user"
            label="用户"
            >
            </el-table-column>
            <el-table-column
            prop="time"
            label="操作时间"
            >
            </el-table-column>
           
            <el-table-column
            fixed="right"
            label="操作"
            >
            <template slot-scope="scope">
              <el-button type="primary" @click="delLogBtn(scope.row.id)">删除</el-button>
            </template>
            </el-table-column>
        </el-table>
    </el-row>

    <el-row>
      <el-col>
        <el-pagination
                background
                :page-sizes="[3, 5, 10, 30]"
                :page-size="pageSize"
                :current-page="pageNum"
                layout="prev, pager, next, total, sizes"
                :total="total"
                @next-click="nextPage"
                @prev-click="prevPage"
                @current-change="changePage"
                @size-change="changeSize"
                >
        </el-pagination>
      </el-col>
    </el-row>

  </div>
</template>

<script>
export default {
  data() {
    return {
        dataList:[],
        pageSize:10,
        pageNum:1,
        total:0,
    }
  },

  methods: {
    queryAllLogs(){
        let pageData={}
        pageData.pageSize=this.pageSize
        pageData.pageNum=this.pageNum
        this.$axios.post('apig/css-order/queryAllLogs',pageData).then(resp=>{
            // console.log(resp.data)
            if(resp.data.code==200){
                this.dataList=resp.data.data.list
                this.total=resp.data.data.total
            }
        })
    },

    delLogBtn(id){
        this.$axios.get("apig/css-order/delLog/"+id).then(resp=>{
            if(resp.data.code==200){
                this.queryAllLogs()
            }
        })
    },

    //下一页方法
    nextPage(val){
                    //回调参数val,val等于当前页码
                    this.pageNum=val
                    this.queryAllLogs()
    },
    //上一页方法
    prevPage(val){
                    //回调参数val,val等于当前页码
                    this.pageNum=val
                    this.queryAllLogs()
    },
    changePage(val){
                    this.pageNum=val
                    this.queryAllLogs()
    },
    changeSize(val){
                    this.pageSize=val
                    this.pageNum=1
                    this.queryAllLogs()
    },
  },

  created(){
    this.queryAllLogs()
  },
}
</script>

<style scoped>
</style>